%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/conditions/archived-forum-inherited-messages.defer-6"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 9, 10, 64, 65, 11, 13, 28<br />2: PgSelect[8]<br />3: PgSelectRows[14]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 11, 28<br /><br />ROOT __Item{1}ᐸ14ᐳ[15]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 16, 11, 28<br /><br />ROOT PgSelectSingle{1}ᐸforumsᐳ[16]<br />1: <br />ᐳ: 17, 19, 25<br />2: PgSelect[20]<br />3: Connection[24]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 24, 20, 11<br /><br />ROOT Connection{2}ᐸ20ᐳ[24]"):::bucket
    Bucket6("Bucket 6 (listItem)<br />Deps: 38, 11<br /><br />ROOT __Item{6}ᐸ29ᐳ[34]"):::bucket
    Bucket7("Bucket 7 (nullableBoundary)<br />Deps: 35, 11<br /><br />ROOT PgSelectSingle{6}ᐸmessagesᐳ[35]"):::bucket
    Bucket8("Bucket 8 (nullableBoundary)<br />Deps: 36, 35, 11, 39<br /><br />ROOT Edge{6}[36]"):::bucket
    Bucket9("Bucket 9 (defer)<br />Deps: 35, 11<br /><br />1: <br />ᐳ: PgClassExpression[41]<br />2: PgSelect[42]<br />3: PgSelectRows[47]<br />ᐳ: First[46], PgSelectSingle[48]"):::bucket
    Bucket10("Bucket 10 (nullableBoundary)<br />Deps: 35, 11<br /><br />ROOT PgSelectSingle{6}ᐸmessagesᐳ[35]"):::bucket
    Bucket11("Bucket 11 (nullableBoundary)<br />Deps: 48<br /><br />ROOT PgSelectSingle{9}ᐸusersᐳ[48]"):::bucket
    Bucket12("Bucket 12 (defer)<br />Deps: 35, 11<br /><br />1: <br />ᐳ: PgClassExpression[51]<br />2: PgSelect[52]<br />3: PgSelectRows[57]<br />ᐳ: First[56], PgSelectSingle[58]"):::bucket
    Bucket13("Bucket 13 (nullableBoundary)<br />Deps: 58<br /><br />ROOT PgSelectSingle{12}ᐸusersᐳ[58]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket6
    Bucket6 --> Bucket7 & Bucket8
    Bucket7 --> Bucket9
    Bucket8 --> Bucket10
    Bucket9 --> Bucket11
    Bucket10 --> Bucket12
    Bucket12 --> Bucket13

    %% plan dependencies
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸforumsᐳ<br />More deps:<br />- Object[11]"]]:::plan
    Lambda13{{"Lambda[13∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'EXCLUSIVELY' ]ᐳ[64]"}}:::plan
    Lambda13 --> PgSelect8
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 4"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect8 --> PgSelectRows14
    Lambda28{{"Lambda[28∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[65]"}}:::plan
    __Item15[/"__Item[15∈1]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸforumsᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    PgSelect20[["PgSelect[20∈2]<br />ᐸmessagesᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression19{{"PgClassExpression[19∈2]<br />ᐸ__forums__.”id”ᐳ"}}:::plan
    PgClassExpression25{{"PgClassExpression[25∈2]<br />ᐸ__forums__...chived_at”ᐳ"}}:::plan
    PgClassExpression19 & PgClassExpression25 & Lambda28 --> PgSelect20
    PgClassExpression17{{"PgClassExpression[17∈2]<br />ᐸ__forums__.”name”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression17
    PgSelectSingle16 --> PgClassExpression19
    Connection24[["Connection[24∈2]<br />ᐸ20ᐳ"]]:::plan
    PgSelect20 --> Connection24
    PgSelectSingle16 --> PgClassExpression25
    ConnectionItems29[["ConnectionItems[29∈3]"]]:::plan
    Connection24 --> ConnectionItems29
    Access38{{"Access[38∈3]<br />ᐸ20.cursorDetailsᐳ"}}:::plan
    PgSelect20 --> Access38
    Edge36{{"Edge[36∈6]"}}:::plan
    __Item34[/"__Item[34∈6]<br />ᐸ29ᐳ"\]:::itemplan
    PgCursor39{{"PgCursor[39∈6]"}}:::plan
    __Item34 & PgCursor39 --> Edge36
    __Item34 & Access38 --> PgCursor39
    ConnectionItems29 ==> __Item34
    PgSelectSingle35{{"PgSelectSingle[35∈6]<br />ᐸmessagesᐳ"}}:::plan
    __Item34 --> PgSelectSingle35
    PgClassExpression37{{"PgClassExpression[37∈7]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle35 --> PgClassExpression37
    PgSelect42[["PgSelect[42∈9]<br />ᐸusersᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression41{{"PgClassExpression[41∈9]<br />ᐸ__messages...author_id”ᐳ"}}:::plan
    PgClassExpression41 --> PgSelect42
    PgSelectSingle35 --> PgClassExpression41
    First46{{"First[46∈9]"}}:::plan
    PgSelectRows47[["PgSelectRows[47∈9]"]]:::plan
    PgSelectRows47 --> First46
    PgSelect42 --> PgSelectRows47
    PgSelectSingle48{{"PgSelectSingle[48∈9]<br />ᐸusersᐳ"}}:::plan
    First46 --> PgSelectSingle48
    PgClassExpression49{{"PgClassExpression[49∈10]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgClassExpression37 o--o PgClassExpression49
    PgClassExpression50{{"PgClassExpression[50∈11]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle48 --> PgClassExpression50
    PgClassExpression59{{"PgClassExpression[59∈11]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression50 o--o PgClassExpression59
    PgSelect52[["PgSelect[52∈12]<br />ᐸusersᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression51{{"PgClassExpression[51∈12]<br />ᐸ__messages...author_id”ᐳ"}}:::plan
    PgClassExpression51 --> PgSelect52
    PgSelectSingle35 --> PgClassExpression51
    First56{{"First[56∈12]"}}:::plan
    PgSelectRows57[["PgSelectRows[57∈12]"]]:::plan
    PgSelectRows57 --> First56
    PgSelect52 --> PgSelectRows57
    PgSelectSingle58{{"PgSelectSingle[58∈12]<br />ᐸusersᐳ"}}:::plan
    First56 --> PgSelectSingle58
    PgClassExpression60{{"PgClassExpression[60∈13]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle58 --> PgClassExpression60
    PgClassExpression61{{"PgClassExpression[61∈13]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression60 o--o PgClassExpression61

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Lambda13,PgSelectRows14,Lambda28 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression17,PgClassExpression19,PgSelect20,Connection24,PgClassExpression25 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,ConnectionItems29,Access38 bucket3
    classDef bucket6 stroke:#ff1493
    class Bucket6,__Item34,PgSelectSingle35,Edge36,PgCursor39 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,PgClassExpression37 bucket7
    classDef bucket8 stroke:#dda0dd
    class Bucket8 bucket8
    classDef bucket9 stroke:#ff0000
    class Bucket9,PgClassExpression41,PgSelect42,First46,PgSelectRows47,PgSelectSingle48 bucket9
    classDef bucket10 stroke:#ffff00
    class Bucket10,PgClassExpression49 bucket10
    classDef bucket11 stroke:#00ffff
    class Bucket11,PgClassExpression50,PgClassExpression59 bucket11
    classDef bucket12 stroke:#4169e1
    class Bucket12,PgClassExpression51,PgSelect52,First56,PgSelectRows57,PgSelectSingle58 bucket12
    classDef bucket13 stroke:#3cb371
    class Bucket13,PgClassExpression60,PgClassExpression61 bucket13

